import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);
import layout from '@/layout'

const routes = [
    {
        path:'/',
        redirect:'/introduce',
        component:layout,
        children:[
            {
                path:'/introduce',
                name:'introduce',
                component:()=>import('../views/introduce/introduce.vue')
            },
        ]
    },
    {
        path:'/dashboard',
        component:layout,
        redirect:'/dashboard/index',
        children:[
            {
                path:'index',
                name:'dashboard',
                component:()=>import('../views/dashboard/index.vue')
            }
        ]
    },
    {
        path:'/login',
        name:'login',
       component:()=>import('@/views/login/login.vue')
    },
    {
        path:'/add',
        component:layout,
        redirect:'/add/index',
        children:[
            {
                path:'index',
                name:'add',
                component:()=>import('../views/addGoods/addGoods.vue')
            }
        ]
    },
    {
        path:'/swiper',
        component:layout,
        redirect:'/swiper/index',
        children:[
            {
                path:'index',
                name:'swiper',
                component:()=>import('../views/swiper/swiper.vue')
            }
        ]
    },
    {
        path:'/hot',
        component:layout,
        redirect:'/hot/index',
        children:[
            {
                path:'index',
                name:'hot',
                component:()=>import('../views/hot/hot.vue')
            }
        ]
    },
    {
        path:'/new',
        component:layout,
        redirect:'/new/index',
        children:[
            {
                path:'index',
                name:'new',
                component:()=>import('../views/new/new.vue')
            }
        ]
    },
    {
        path:'/recommend',
        component:layout,
        redirect:'/recommend/index',
        children:[
            {
                path:'index',
                name:'recommend',
                component:()=>import('../views/recommend/recommend.vue')
            }
        ]
    },
    {
        path:'/category',
        component:layout,
        redirect:'/category/index',
        children:[
            {
                path:'index',
                name:'category',
                component:()=>import('../views/category/category.vue'),
                children:[
                    {
                        path:'level2',
                        name:'level2',
                        component:()=>import('../views/categoryLevel2/categoryLevel2.vue')
                    },
                    {
                        path:'level3',
                        name:'level3',
                        component:()=>import('../views/categoryLevel3/categoryLevel3.vue')
                    }
                ]
            }
        ]
    },
    {
        path:'/good',
        component:layout,
        redirect:'/good/index',
        children:[
            {
                path:'index',
                name:'good',
                component:()=>import('../views/good/good.vue')
            }
        ]
    },
    {
        path:'/guest',
        component:layout,
        redirect:'/guest/index',
        children:[
            {
                path:'index',
                name:'guest',
                component:()=>import('../views/guest/guest.vue')
            }
        ]
    },
    {
        path:'/order',
        component:layout,
        redirect:'/order/index',
        children:[
            {
                path:'index',
                name:'order',
                component:()=>import('../views/order/order.vue')
            }
        ]
    },
    {
        path:'/order_detail',
        component:layout,
        redirect:'/order_detail/index',
        children:[
            {
                path:'index',
                name:'order_detail',
                component:()=>import('../views/order_detail/order_detail.vue')
            }
        ]
    },
    {
        path:'/account',
        component:layout,
        redirect:'/account/index',
        children:[
            {
                path:'index',
                name:'account',
                component:()=>import('@/views/account/account.vue')
            }
        ]
    }
]

const router = new Router({
    routes
});
export default router